﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace TlvLib.PacketParsers
{
    class TimeSyncPacker
    {
        public byte[] Pack(DateTime now)
        {
            var mem = new MemoryStream(32);
            var writer = new MiscUtil.IO.EndianBinaryWriter(Config.EndianBitConverter, mem);

            writer.Write((short)now.Year);
            writer.Write((short)now.Month);
            writer.Write((short)now.Day);
            writer.Write((short)now.Hour);
            writer.Write((short)now.Minute);
            writer.Write((short)now.Second);
            writer.Write((short)now.Millisecond);

            return mem.ToArray();
        }
    }
}
